package com.yoga.admin.api.web;

import com.yoga.common.appexception.AppException;
import com.yoga.common.appexception.YogaResult;
import com.yoga.common.bo.PrivateVipBO;
import com.yoga.manager.admin.AdminPrivateVipManager;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by hdx on 2020/10/21.
 */
@RestController
@RequestMapping("${basePath}")
public class AdminPrivateVipController {

    @Resource
    private AdminPrivateVipManager privateVipManager;

    @PostMapping("/privateVip/open")
    public YogaResult<Boolean> openPrivateVip(PrivateVipBO privateVipBO) throws AppException {
        Boolean result = privateVipManager.openPrivateVip(privateVipBO);

        return new YogaResult<>(result);
    }

    @PostMapping("/privateVip/getByUserId")
    public YogaResult<PrivateVipBO> getByUserId(Long yogaUserId) throws AppException {
        PrivateVipBO result = privateVipManager.getByUserId(yogaUserId);

        return new YogaResult<>(result);
    }

    @PostMapping("/privateVip/updateData")
    public YogaResult<Boolean> updatePrivateVip(PrivateVipBO privateVipBO) throws AppException {
        Boolean result = privateVipManager.updatePrivateVip(privateVipBO);

        return new YogaResult<>(result);
    }


}
